package stores

import (
	"lesson01/instructions/base"
	"lesson01/rtda"
)

type LLoad struct {
	base.Index8Instruction
}

func (e *LLoad) Execute(frame *rtda.Frame) {
	_lload(frame, uint(e.Index))
}

type LLoad_0 struct {
	base.NoOperandsInstruction
}

func (e *LLoad_0) Execute(frame *rtda.Frame) {
	_lload(frame, 0)
}

type LLoad_1 struct {
	base.NoOperandsInstruction
}

func (e *LLoad_1) Execute(frame *rtda.Frame) {
	_lload(frame, 1)
}

type LLoad_2 struct {
	base.NoOperandsInstruction
}

func (e *LLoad_2) Execute(frame *rtda.Frame) {
	_lload(frame, 2)
}

type LLoad_3 struct {
	base.NoOperandsInstruction
}

func (e *LLoad_3) Execute(frame *rtda.Frame) {
	_lload(frame, 3)
}

func _lload(frame *rtda.Frame, index uint) {
	val := frame.LocalVars().GetLong(index)
	frame.OperandStack().PushLong(val)
}
